package com.lk.springboot.bean;

/**
 * @author lk
 * @date 2020/1/7 0007 19:15
 *      1.统一的json数据格式的 请求响应信息
 *      {
 *          "code":"200",
 *          "msg":"okokokokok",
 *          "data":[
 *              "asd",
 *              "qwe"
 *          ]
 *      }
 *      2.调用枚举类存储的状态码与状态信息
 */
public class JsonResult<T> {
    private  String code;
    private  String  msg;
    private  T data;

    public JsonResult() {
        this.code = "0";
        this.msg = "未返回数据";
    }

    public JsonResult(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public JsonResult(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMessage();
    }
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
